<template>
    <div class="container">
        <van-cell-group>
            <van-card
                    v-for="(item, index) in list" :key="index"
                    :title="item.name"
                    :thumb="item.img"
                    icon="arrow"
                    @click="info(item)"
            >
<!--                <span>-->
<!--                    <img :src="item.img" style="width: 3.5em;height: 3.5em;"/>-->
<!--                </span>-->
            </van-card>
        </van-cell-group>
    </div>
</template>

<script>
import { ImagePreview } from 'vant'

export default {
  data () {
    return {
      list: [],
      images: []
    }
  },
  methods: {
    init () {
      this.$http({
        fun: 'ctcgovernmentmedia',
        requestType: 'get',
        cb: res => {
          this.list = res
        }
      })
    },
    info (item) {
      this.images = []
      this.images.push(item.img)
      // console.log(item.type)
      if (item.type === '1') {
        window.location.href = item.url
      } else {
        ImagePreview(this.images)
      }
    }
  },

  mounted () {
    this.init()
  }
}
</script>

<style>
    .van-card{
        height:80px;
    }
    .van-card__header{
        height:80px;
    }
    .van-card__content{
        height: 80px;
    }
    .van-card__title{
        font-size: larger;
        margin-top: 1.8em;
    }
    .van-card__thumb{
        width: 80px;
        height: 80px;
    }
    .van-card__thumb img{
        width: 4em;
        height: 4em;
    }
</style>
